(ns web
  (:use    
    
    [compojure.core]    
    [ring.util.response]    
    [ring.middleware.params]        
    [ring.middleware.multipart-params]    
    [ring.middleware.session]
    [controllers.upload]
    [view.stranice]    
    )
  (:require [compojure.route :as route]
            )  
  )

;sesija - globalna promenljiva?
            ;citanje i upisivanje u fajl


(defroutes rou
  
  (GET "/slika" {params :params} (slika-d (get params "putanja")))
  (GET "/" [] (redirect "/pocetna.html")  )         
  (GET "/login" [] (view-login))  
  (GET "/registracija" [] (view-registracija)) 
  (POST "/registracija" {params :params} (reg params ));provera u bazi pa preusmeravanje  
  (POST "/login" {params :params }  (login params ))  ;provera u bazi pa preusmeravanje 
  (POST "/file" {params :params}
       (let [file (get params "file")
             f (get params "filter")
             p (get params "parametar")]
        (upload-file file f p))) 
  (route/files "/")
   (route/not-found "<h1>Not Found</h1>")
  )

(def app (-> rou  wrap-params wrap-multipart-params ))
